package enterprise.web.tookit.user;

import java.io.Serializable;

/**
 * @since 22/11/2012
 * 
 * @author regis rocha
 * 
 * @description Composite key to user_roles table
 * 
 */
public class UserRolePk implements Serializable {

	/**
	 * serial version
	 */
	private static final long serialVersionUID = -789936316897344961L;

	private String userName;

	private String roleName;

	/**
	 * @return the userName
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * @param userName
	 *            the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * @return the roleName
	 */
	public String getRoleName() {
		return roleName;
	}

	/**
	 * @param roleName
	 *            the roleName to set
	 */
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}

	@Override
	public int hashCode() {
		if (this.userName != null && this.roleName != null) {
			return this.userName.hashCode() + this.roleName.hashCode();
		} else {
			return super.hashCode();
		}
	}
}
